# - Try to find Python26
# Once done this will define
#
#  PYTHON26_FOUND - system has Python26
#  PYTHON26_INCLUDE_DIR - the Python26 include directory
#  PYTHON26_LIBRARIES - Link these to use Python26

# Copyright (c) 2006, Carsten Niehaus, <cniehaus@gmx.de>
# Modified 2008, Jason Power, <power.jg@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

if (PYTHON26_INCLUDE_DIR AND PYTHON26_LIBRARIES)

  # in cache already
  set(PYTHON26_FOUND TRUE)

else (PYTHON26_INCLUDE_DIR AND PYTHON26_LIBRARIES)
	if(NOT WIN32)

	  find_path(PYTHON26_INCLUDE_DIR Python.h
		/usr/include/python
		/usr/include/python2.6
		$ENV{PYTHON26_INCLUDE_DIR}
	  )

	  find_library(PYTHON26_LIBRARIES libpython2.6.so
		PATHS
		/usr/lib64
		/usr/lib
		/usr/local/lib
		/usr/local/lib64
		$ENV{PYTHON26_LIBRARIES}
	  )
	  set(PYTHON26_FOUND TRUE)
	else(NOT WIN32)
	  set(WINDOWS TRUE)
	endif(NOT WIN32)
  if(WINDOWS)

	  find_path(PYTHON26_INCLUDE_DIR include/Python.h
		C:/Python25/
		$ENV{PYTHON26_INCLUDE_DIR}
	  )

	  find_library(PYTHON26_LIBRARIES NAMES libpython25.lib
		PATHS
		C:/Python25/libs/
		$ENV{PYTHON26_LIBRARIES}
	  )

  endif(WINDOWS)

  if(PYTHON26_INCLUDE_DIR AND PYTHON26_LIBRARIES AND WINDOWS)
    set(PYTHON26_FOUND TRUE)
  endif(PYTHON26_INCLUDE_DIR AND PYTHON26_LIBRARIES AND WINDOWS)

  if (PYTHON26_FOUND)
      message(STATUS "Found Python26: ${PYTHON26_LIBRARIES}")
  else (PYTHON26_FOUND)
      message(FATAL_ERROR "Could NOT find Python26")
  endif (PYTHON26_FOUND)

  mark_as_advanced(PYTHON26_INCLUDE_DIR PYTHON26_LIBRARIES)

endif (PYTHON26_INCLUDE_DIR AND PYTHON26_LIBRARIES)

